from fastapi import FastAPI, Form
import uvicorn

app = FastAPI()


# 接收表单数据的POST接口
@app.post("/test/{val}")
async def add_student(val):
    """post method方式"""
    print(f"val={val}")
    return f"val={val}"

if __name__ == "__main__":
    uvicorn.run(
        app,
        host="0.0.0.0",
        port=9988,
        timeout_keep_alive=10,  # 保持连接时间（秒）
    )
